﻿using SqlSugar;
using System;
using System.ComponentModel.DataAnnotations;

namespace tlBasic.Core
{
    public abstract class EntityBaseId
    {
        /// <summary>
        /// 雪花Id
        /// </summary>
        [SugarColumn(ColumnDescription = "Id", IsPrimaryKey = true, IsIdentity = false)]
        public virtual long Id { get; set; }
       
    }

    public abstract class DEntityBase : EntityBaseId
    {
        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnDescription = "创建时间",IsOnlyIgnoreUpdate =true)]
        public virtual DateTime? CreatedTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(ColumnDescription = "更新时间")]
        public virtual DateTime? UpdatedTime { get; set; }

        /// <summary>
        /// 创建者Id
        /// </summary>
        [SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true)]
        public virtual long CreatedUserId { get; set; }

        /// <summary>
        /// 创建者名称
        /// </summary>
        [SugarColumn(ColumnDescription = "创建者名称", IsOnlyIgnoreUpdate = true)]
        public virtual string CreatedUserName { get; set; }

        /// <summary>
        /// 修改者Id
        /// </summary>
        [SugarColumn(ColumnDescription = "修改者Id")]
        public virtual long? UpdatedUserId { get; set; }

        /// <summary>
        /// 修改者名称
        /// </summary>
        [SugarColumn(ColumnDescription = "修改者名称")]
        [MaxLength(50)]
        public virtual string UpdatedUserName { get; set; }

        /// <summary>
        /// 软删除
        /// </summary>
        [SugarColumn(ColumnDescription = "软删除", ColumnDataType = "bit" )] 
        public virtual bool IsDeleted { get; set; } = false;
    }
}